//
//  ViewController.m
//  long_content_label
//
//  Created by Shawn on 13-8-19.
//  Copyright (c) 2013年 shawn. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)loadView
{
    CGRect screenSize = [[UIScreen mainScreen] bounds];
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:screenSize];
    
    NSString *str = @"The simplest way to create views is to assemble them graphically using Interface Builder. From Interface Builder, you can add views to your interface, arrange those views into hierarchies, configure each view’s settings, and connect view-related behaviors to your code. Because Interface Builder uses live view objects—that is, actual instances of the view classes—what you see at design time is what you get at runtime. You then save those live objects in a nib file, which is a resource file that preserves the state and configuration of your objects.";
    
    CGSize constraintSize = CGSizeMake(screenSize.size.width, MAXFLOAT);
    UIFont *font = [UIFont systemFontOfSize:30];
    CGSize size = [str sizeWithFont:font constrainedToSize:constraintSize];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
    [label setFont:[UIFont systemFontOfSize:30]];
    [label setText:str];
    [label setNumberOfLines:0];
    
    [scrollView setContentSize:size];
    [scrollView addSubview:label];
    [self setView:scrollView];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
